package com.example.innovate.controller;

import com.example.innovate.bean.Result;
import com.example.innovate.domain.StarPointDO;
import com.example.innovate.service.StarPointService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/starPoint")
@Api(tags = "星级分接口")
public class StarPointController {
    @Autowired
    StarPointService starPointService;

    @GetMapping("/findAllStarPoint")
    @ApiOperation("查找所有星级分信息")
    public Result findAllCompetition(@RequestParam("pageNumber") Integer pageNumber,
                                     @RequestParam("pageSize") Integer pageSize) throws Exception{
        List<StarPointDO> list = starPointService.findByList(pageNumber,pageSize);
        return new Result(200,"success","查找成功",list);
    }

    @PostMapping("/")
    @ApiOperation("更新现有星级分")
    public Result addCompetition() throws Exception{
        starPointService.addPoint();
        return new Result(200,"success","更新成功",null);
    }
}
